IF EXISTS (SELECT '1' FROM TDmsDocType WHERE DocType_Id = 1)
	UPDATE TDmsDocType SET NamingExpr = 'JOIN(SubString(GetYYYY(CreationDate()),3,2)," ",GetMM(CreationDate())," ",GetDD(CreationDate()), SPACE(1))' WHERE DocType_Id = 1

IF EXISTS (SELECT '1' FROM TDmsDocType WHERE DocType_Name = 'Renewal Letter')
	UPDATE TDmsDocType  SET NamingExpr = 'Join(SubString(GetYYYY(CreationDate()),3,2)," ",GetMM(CreationDate())," ",GetDD(CreationDate()),Space(1),"RNL Letter to Client")' 
		WHERE DocType_Name = 'Renewal Letter'

IF EXISTS (SELECT '1' FROM TDmsDocType WHERE DocType_Name = 'Insurer Quote Request (New Business)')
	UPDATE TDmsDocType  SET NamingExpr = 'Join(SubString(GetYYYY(CreationDate()),3,2)," ",GetMM(CreationDate())," ",GetDD(CreationDate()),Space(1),"INS QTE REQ New Business")'
		WHERE DocType_Name = 'Insurer Quote Request (New Business)'

IF EXISTS (SELECT '1' FROM TDmsDocType WHERE DocType_Name = 'Proposal (New Business)')
	UPDATE TDmsDocType  SET NamingExpr =  'Join(SubString(GetYYYY(CreationDate()),3,2)," ",GetMM(CreationDate())," ",GetDD(CreationDate()),Space(1),"PROP NB")'
		WHERE DocType_Name = 'Proposal (New Business)'

IF EXISTS (SELECT '1' FROM TDmsDocType WHERE DocType_Name = 'Quotation Client (New Business)')
	UPDATE TDmsDocType  SET NamingExpr = 'Join(SubString(GetYYYY(CreationDate()),3,2)," ",GetMM(CreationDate())," ",GetDD(CreationDate()),Space(1),"Quote NB")'
		WHERE DocType_Name = 'Quotation Client (New Business)'

IF EXISTS (SELECT '1' FROM TDmsDocType WHERE DocType_Name = 'Cover Request Bind Cover (New Business)')
	UPDATE TDmsDocType  SET NamingExpr = 'Join(SubString(GetYYYY(CreationDate()),3,2)," ",GetMM(CreationDate())," ",GetDD(CreationDate()),Space(1),"COV REQ Blind Cover NB")'
		WHERE DocType_Name = 'Cover Request Bind Cover (New Business)'

IF EXISTS (SELECT '1' FROM TDmsDocType WHERE DocType_Name = 'Invoice (New Business)')
	UPDATE TDmsDocType  SET NamingExpr = 'Join(SubString(GetYYYY(CreationDate()),3,2)," ",GetMM(CreationDate())," ",GetDD(CreationDate()),Space(1),"INV NB")'
		WHERE DocType_Name = 'Invoice (New Business)'

IF EXISTS (SELECT '1' FROM TDmsDocType WHERE DocType_Name = 'Request More Details Client (New Business)')
	UPDATE TDmsDocType  SET NamingExpr = 'Join(SubString(GetYYYY(CreationDate()),3,2)," ",GetMM(CreationDate())," ",GetDD(CreationDate()),Space(1),"REQ More Details Client NB")'
		WHERE DocType_Name = 'Request More Details Client (New Business)'

IF EXISTS (SELECT '1' FROM TDmsDocType WHERE DocType_Name = 'Request More Details Insurer (New Business)')
	UPDATE TDmsDocType  SET NamingExpr = 'Join(SubString(GetYYYY(CreationDate()),3,2)," ",GetMM(CreationDate())," ",GetDD(CreationDate()),Space(1),"REQ More Details Insurer NB")'
		WHERE DocType_Name = 'Request More Details Insurer (New Business)'

IF EXISTS (SELECT '1' FROM TDmsDocType WHERE DocType_Name = 'Insurer Renewal Terms (Renewal)')
	UPDATE TDmsDocType  SET NamingExpr = 'Join(SubString(GetYYYY(CreationDate()),3,2)," ",GetMM(CreationDate())," ",GetDD(CreationDate()),Space(1),"Insurer RNL Terms")'
		WHERE DocType_Name = 'Insurer Renewal Terms (Renewal)'

IF EXISTS (SELECT '1' FROM TDmsDocType WHERE DocType_Name = 'Quotation Client (Renewal)')
	UPDATE TDmsDocType  SET NamingExpr = 'Join(SubString(GetYYYY(CreationDate()),3,2)," ",GetMM(CreationDate())," ",GetDD(CreationDate()),Space(1),"Qoute Client RNL")'
		WHERE DocType_Name = 'Quotation Client (Renewal)'

IF EXISTS (SELECT '1' FROM TDmsDocType WHERE DocType_Name = 'Cover Request Bind Cover (Renewal)')
	UPDATE TDmsDocType  SET NamingExpr = 'Join(SubString(GetYYYY(CreationDate()),3,2)," ",GetMM(CreationDate())," ",GetDD(CreationDate()),Space(1),"Cover Request Blind Cover RNL")'
		WHERE DocType_Name = 'Cover Request Bind Cover (Renewal)'

IF EXISTS (SELECT '1' FROM TDmsDocType WHERE DocType_Name = 'Invoice (Renewal)')
	UPDATE TDmsDocType  SET NamingExpr = 'Join(SubString(GetYYYY(CreationDate()),3,2)," ",GetMM(CreationDate())," ",GetDD(CreationDate()),Space(1),"Invoice RNL")'
		WHERE DocType_Name = 'Invoice (Renewal)'

IF EXISTS (SELECT '1' FROM TDmsDocType WHERE DocType_Name = 'Request More Details Client (Renewal)')
	UPDATE TDmsDocType  SET NamingExpr = 'Join(SubString(GetYYYY(CreationDate()),3,2)," ",GetMM(CreationDate())," ",GetDD(CreationDate()),Space(1),"Request More Details Client RNL")'
		WHERE DocType_Name = 'Request More Details Client (Renewal)'

IF EXISTS (SELECT '1' FROM TDmsDocType WHERE DocType_Name = 'Request More Details Insurer (Renewal)')
	UPDATE TDmsDocType  SET NamingExpr = 'Join(SubString(GetYYYY(CreationDate()),3,2)," ",GetMM(CreationDate())," ",GetDD(CreationDate()),Space(1),"Request More Details Insurer RNL")'
		WHERE DocType_Name = 'Request More Details Insurer (Renewal)'

IF EXISTS (SELECT '1' FROM TDmsDocType WHERE DocType_Name = 'Endorsement - Extra Premium')
	UPDATE TDmsDocType  SET NamingExpr = 'Join(SubString(GetYYYY(CreationDate()),3,2)," ",GetMM(CreationDate())," ",GetDD(CreationDate()),Space(1),"Endorsement - Extra Premium")'
		WHERE DocType_Name = 'Endorsement - Extra Premium'

IF EXISTS (SELECT '1' FROM TDmsDocType WHERE DocType_Name = 'Endorsement - Refund')
	UPDATE TDmsDocType  SET NamingExpr = 'Join(SubString(GetYYYY(CreationDate()),3,2)," ",GetMM(CreationDate())," ",GetDD(CreationDate()),Space(1),"Endorsement Refund")'
		WHERE DocType_Name = 'Endorsement - Refund'

IF EXISTS (SELECT '1' FROM TDmsDocType WHERE DocType_Name = 'Endorsement - 0.00')
	UPDATE TDmsDocType  SET NamingExpr = 'Join(SubString(GetYYYY(CreationDate()),3,2)," ",GetMM(CreationDate())," ",GetDD(CreationDate()),Space(1),"Endorsement - 0.00")'
		WHERE DocType_Name = 'Endorsement - 0.00'

IF EXISTS (SELECT '1' FROM TDmsDocType WHERE DocType_Name = 'Closing')
	UPDATE TDmsDocType  SET NamingExpr = 'Join(SubString(GetYYYY(CreationDate()),3,2)," ",GetMM(CreationDate())," ",GetDD(CreationDate()),Space(1),"CLOSING")'
		WHERE DocType_Name = 'Closing'

IF EXISTS (SELECT '1' FROM TDmsDocType WHERE DocType_Name = 'Insurer Payment')
	UPDATE TDmsDocType  SET NamingExpr = 'Join(SubString(GetYYYY(CreationDate()),3,2)," ",GetMM(CreationDate())," ",GetDD(CreationDate()),Space(1),"Insurer Payment")'
		WHERE DocType_Name = 'Insurer Payment'

IF EXISTS (SELECT '1' FROM TDmsDocType WHERE DocType_Name = 'Client Refund')
	UPDATE TDmsDocType  SET NamingExpr = 'Join(SubString(GetYYYY(CreationDate()),3,2)," ",GetMM(CreationDate())," ",GetDD(CreationDate()),Space(1),"Client Refund")'
		WHERE DocType_Name = 'Client Refund'

IF EXISTS (SELECT '1' FROM TDmsDocType WHERE DocType_Name = 'Insurer Refund')
	UPDATE TDmsDocType  SET NamingExpr = 'Join(SubString(GetYYYY(CreationDate()),3,2)," ",GetMM(CreationDate())," ",GetDD(CreationDate()),Space(1),"Insurer Refund")'
		WHERE DocType_Name = 'Insurer Refund'

IF EXISTS (SELECT '1' FROM TDmsDocType WHERE DocType_Name = 'Cancellation')
	UPDATE TDmsDocType  SET NamingExpr = 'Join(SubString(GetYYYY(CreationDate()),3,2)," ",GetMM(CreationDate())," ",GetDD(CreationDate()),Space(1),"Cancellation")'
		WHERE DocType_Name = 'Cancellation'

IF EXISTS (SELECT '1' FROM TDmsDocType WHERE DocType_Name = 'Claim Acknowledgement')
	UPDATE TDmsDocType  SET NamingExpr = 'Join(SubString(GetYYYY(CreationDate()),3,2)," ",GetMM(CreationDate())," ",GetDD(CreationDate()),Space(1),"Claim Acknowledgement")'
		WHERE DocType_Name = 'Claim Acknowledgement'

IF EXISTS (SELECT '1' FROM TDmsDocType WHERE DocType_Name = 'Claim Notification')
	UPDATE TDmsDocType  SET NamingExpr = 'Join(SubString(GetYYYY(CreationDate()),3,2)," ",GetMM(CreationDate())," ",GetDD(CreationDate()),Space(1),"Claim Notification")'
		WHERE DocType_Name = 'Claim Notification'

IF EXISTS (SELECT '1' FROM TDmsDocType WHERE DocType_Name = 'Claim Finalisation')
	UPDATE TDmsDocType  SET NamingExpr = 'Join(SubString(GetYYYY(CreationDate()),3,2)," ",GetMM(CreationDate())," ",GetDD(CreationDate()),Space(1),"Claim Finalisation")'
		WHERE DocType_Name = 'Claim Finalisation'

IF EXISTS (SELECT '1' FROM TDmsDocType WHERE DocType_Name = 'Proposal (Application Form)')
	UPDATE TDmsDocType  SET NamingExpr = 'Join(SubString(GetYYYY(CreationDate()),3,2)," ",GetMM(CreationDate())," ",GetDD(CreationDate()),Space(1),"Proposal Application Form")'
		WHERE DocType_Name = 'Proposal (Application Form)'

IF EXISTS (SELECT '1' FROM TDmsDocType WHERE DocType_Name = 'Claim Form')
	UPDATE TDmsDocType  SET NamingExpr = 'Join(SubString(GetYYYY(CreationDate()),3,2)," ",GetMM(CreationDate())," ",GetDD(CreationDate()),Space(1),"Claim Form")'
		WHERE DocType_Name = 'Claim Form'

